package model;


import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.SessionFactory;

import util.hibernate.HibernateUtil;

import databean.User;

public class UserDAO {

	private ProductDAO productDAO;

	public UserDAO() {
		productDAO = new ProductDAO();
		addDummyData();
	}

	
	public ArrayList<User> getAllUsers() {
    	
    	ArrayList<User> users = new ArrayList<User>();
    	User user;
		org.hibernate.classic.Session session = null;
		
		try {
			
			SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
			session = sessionFactory.openSession();

			Criteria crit = session.createCriteria(User.class);
			
			@SuppressWarnings("unchecked")
			List<User> dbTokboxes = crit.list();

			user = new User();
			
			for (Iterator<User> it = dbTokboxes.iterator();it.hasNext();){
				
				user = (User) it.next();
				users.add(user);
				
			}
			

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.flush();
			session.close();
		}
		
		return users;
    }
	
	
	public long getUserIDByUserName(String username)
			throws java.sql.SQLException {

		long userID = -1;
		org.hibernate.classic.Session session = null;

		try {

			SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
			session = sessionFactory.openSession();

			Connection connection = session.connection();
			Statement statement = connection.createStatement();
			ResultSet result;

			String query = "select userID from user where username='"
					+ username + "'";
			result = statement.executeQuery(query);
			result.next();

			userID = result.getLong("userID");

			statement.close();
			result.close();

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.flush();
			session.close();
		}

		return userID;
	}

	public long getUserIDByEmail(String email) throws java.sql.SQLException {

		long userID = -1;
		org.hibernate.classic.Session session = null;

		try {

			SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
			session = sessionFactory.openSession();

			Connection connection = session.connection();
			Statement statement = connection.createStatement();
			ResultSet result;

			String query = "select userID from user where email='" + email
					+ "'";
			result = statement.executeQuery(query);
			result.next();

			userID = result.getLong("userID");

			statement.close();
			result.close();

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.flush();
			session.close();
		}

		return userID;
	}


	public static String getUserNameByUserID(long userID) throws java.sql.SQLException{
		
		String userName = null;
		org.hibernate.classic.Session session = null;
		
		try {
			
			SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
			session = sessionFactory.openSession();
			
			Connection connection = session.connection();
			Statement statement = connection.createStatement();
			ResultSet result;
			
			String query = "select userName from user where userID='"+userID+"'";
			result = statement.executeQuery(query);
			result.next();
			
			userName = result.getString("userName");
						
			statement.close();
			result.close();
			
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.flush();
			session.close();
		}
		
		return userName;
	}
	
	
	public User getUserByUsername(String username) throws java.sql.SQLException{
		
		User user = new User();
		org.hibernate.classic.Session session = null;
		
		try {
			
			SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
			session = sessionFactory.openSession();
			
			Connection connection = session.connection();
			Statement statement = connection.createStatement();
			ResultSet result;
			
			String query = "select * from user where username='"+username+"'";
			result = statement.executeQuery(query);
			result.next();
			
			user.setUserID(result.getLong("userID"));
			user.setUserName(result.getString("userName"));
			user.setHashedPassword(result.getString("hashedPassword"));
			user.setSalt(result.getInt("salt"));
			user.setProfilePicPath(result.getString("profilePicPath"));
			user.setFirstName(result.getString("firstName"));
			user.setLastName(result.getString("lastName"));
			user.setEmail(result.getString("email"));			
			user.setJobTitle(result.getString("jobTitle"));
			user.setCompany(result.getString("company"));
			user.setProductIDs(result.getString("productIDs"));
			user.setPreferredLang(result.getString("preferredLang"));
			user.setTimeZone(result.getString("timeZone"));
			user.setStartWorkTime(result.getString("startWorkTime"));
			user.setEndWorkTime(result.getString("endWorkTime"));
			user.setStreetAddress1(result.getString("streetAddress1"));
			user.setStreetAddress2(result.getString("streetAddress2"));
			user.setZipCode(result.getString("zipCode"));
			user.setCity(result.getString("city"));
			user.setState(result.getString("state"));
			user.setCountry(result.getString("country"));
			
			statement.close();
			result.close();
			
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.flush();
			session.close();
		}
		
		return user;
	}
	
	
	public User getUserByUserID(long userID) throws java.sql.SQLException{
		
		User user = new User();
		org.hibernate.classic.Session session = null;
		
		try {
			
			SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
			session = sessionFactory.openSession();
			
			Connection connection = session.connection();
			Statement statement = connection.createStatement();
			ResultSet result;
			
			String query = "select * from user where userID='"+userID+"'";
			result = statement.executeQuery(query);
			result.next();
			
			user.setUserID(result.getLong("userID"));
			user.setUserName(result.getString("userName"));
			user.setHashedPassword(result.getString("hashedPassword"));
			user.setSalt(result.getInt("salt"));
			user.setProfilePicPath(result.getString("profilePicPath"));
			user.setFirstName(result.getString("firstName"));
			user.setLastName(result.getString("lastName"));
			user.setEmail(result.getString("email"));			
			user.setJobTitle(result.getString("jobTitle"));
			user.setCompany(result.getString("company"));
			user.setProductIDs(result.getString("productIDs"));
			user.setPreferredLang(result.getString("preferredLang"));
			user.setTimeZone(result.getString("timeZone"));
			user.setStartWorkTime(result.getString("startWorkTime"));
			user.setEndWorkTime(result.getString("endWorkTime"));
			user.setStreetAddress1(result.getString("streetAddress1"));
			user.setStreetAddress2(result.getString("streetAddress2"));
			user.setZipCode(result.getString("zipCode"));
			user.setCity(result.getString("city"));
			user.setState(result.getString("state"));
			user.setCountry(result.getString("country"));
			
			statement.close();
			result.close();
			
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.flush();
			session.close();
		}
		
		return user;
	}
	
	
	public User getUserByEmail(String email) throws java.sql.SQLException{
		
		User user = new User();
		org.hibernate.classic.Session session = null;
		
		try {
			
			SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
			session = sessionFactory.openSession();
			
			Connection connection = session.connection();
			Statement statement = connection.createStatement();
			ResultSet result;
			
			String query = "select * from user where email='"+email+"'";
			result = statement.executeQuery(query);
			result.next();
			
			user.setUserID(result.getLong("userID"));
			user.setUserName(result.getString("userName"));
			user.setHashedPassword(result.getString("hashedPassword"));
			user.setSalt(result.getInt("salt"));
			user.setProfilePicPath(result.getString("profilePicPath"));
			user.setFirstName(result.getString("firstName"));
			user.setLastName(result.getString("lastName"));
			user.setEmail(result.getString("email"));			
			user.setJobTitle(result.getString("jobTitle"));
			user.setCompany(result.getString("company"));
			user.setProductIDs(result.getString("productIDs"));
			user.setPreferredLang(result.getString("preferredLang"));
			user.setTimeZone(result.getString("timeZone"));
			user.setStartWorkTime(result.getString("startWorkTime"));
			user.setEndWorkTime(result.getString("endWorkTime"));
			user.setStreetAddress1(result.getString("streetAddress1"));
			user.setStreetAddress2(result.getString("streetAddress2"));
			user.setZipCode(result.getString("zipCode"));
			user.setCity(result.getString("city"));
			user.setState(result.getString("state"));
			user.setCountry(result.getString("country"));
			
			statement.close();
			result.close();
			
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.flush();
			session.close();
		}
		
		return user;
	}
	
	
	public void updateUser(User user) {

	}

	public boolean checkValidUserName(String userName)
			throws java.sql.SQLException {

		org.hibernate.classic.Session session = null;
		boolean valid = false;

		try {

			SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
			session = sessionFactory.openSession();

			Connection connection = session.connection();
			Statement statement = connection.createStatement();
			ResultSet result;

			String query = "select userID from user where userName='"
					+ userName + "'";
			result = statement.executeQuery(query);

			if (result.next() == true) {
				valid = true;
			} else {
				valid = false;
			}

			statement.close();
			result.close();

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.flush();
			session.close();
		}

		return valid;
	}

	public void createUser(User user) {

		org.hibernate.classic.Session session = null;

		try {

			SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
			session = sessionFactory.openSession();

			Connection connection = session.connection();
			Statement statement = connection.createStatement();
			ResultSet result;

			// checking if same entry is already in database
			String query = "select userID from user where email='"
					+ user.getEmail() + "'";
			result = statement.executeQuery(query);

			// yes - ignore; no - add a new email record
			if (result.next() == true) {
				// ignore
			} else {
				// start inserting
				org.hibernate.Transaction tx = session.beginTransaction();
				session.saveOrUpdate(user);
				tx.commit();
			}

			statement.close();
			result.close();

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.flush();
			session.close();
		}
	}

	public void addDummyData() {

		try {

			User user;
			//dudu 1
			user = new User();
			user.setFirstName("Vivian");
			user.setLastName("Tan");
			user.setProfilePicPath("thumbs/img1.jpg");
			user.setGender("female");
			user.setEmail("tanxueshan@gmail.com");
			user.setUserName("tanxueshan@gmail.com");
			user.setPassword("tanxueshan");
			user.setPhone("+1-412-234-2353");
			user.setJobTitle("Sales and Marketing Manager");
			user.setCompany("WatchFactory, Inc.");

			String productIDs = productDAO
					.getProductIDByName("DX Uncrushable C100") + "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("EDT");
			user.setStartWorkTime("0900");
			user.setEndWorkTime("1800");
			user.setStreetAddress1("75 Chongwenmennei");
			user.setStreetAddress2("Dongcheng District");
			user.setZipCode("100005");
			user.setCity("Beijing");
			user.setState("Beijing");
			user.setCountry("China");

			createUser(user);
			
			//dudu 2
//			user = new User();
//			user.setFirstName("Eric");
//			user.setLastName("Lin");
//			user.setProfilePicPath("thumbs/adamhenry.png");
//			user.setGender("female");
//			user.setEmail("cmueric@gmail.com");
//			user.setUserName("cmueric@gmail.com");
//			user.setPassword("cmueric");
//			user.setPhone("+1-412-234-2353");
//			user.setJobTitle("Sales and Marketing Manager");
//			user.setCompany("WatchFactory, Inc.");
//
//			productIDs = productDAO
//					.getProductIDByName("DX Uncrushable C100") + "";
//			user.setProductIDs(productIDs);
//
//			user.setPreferredLang("English");
//			user.setTimeZone("EDT");
//			user.setStartWorkTime("0900");
//			user.setEndWorkTime("1800");
//			user.setStreetAddress1("75 Chongwenmennei");
//			user.setStreetAddress2("Dongcheng District");
//			user.setZipCode("100005");
//			user.setCity("Beijing");
//			user.setState("Beijing");
//			user.setCountry("China");
//
//			createUser(user);
			
			//dudu 3
			user = new User();
			user.setFirstName("Danny");
			user.setLastName("Tan");
			user.setProfilePicPath("thumbs/img1.jpg");
			user.setGender("female");
			user.setEmail("xueshant@andrew.cmu.edu");
			user.setUserName("xueshant@andrew.cmu.edu");
			user.setPassword("xueshant");
			user.setPhone("+1-412-234-2353");
			user.setJobTitle("Sales and Marketing Manager");
			user.setCompany("WatchFactory, Inc.");

			productIDs = productDAO
					.getProductIDByName("DX Uncrushable C100") + "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("EDT");
			user.setStartWorkTime("0900");
			user.setEndWorkTime("1800");
			user.setStreetAddress1("75 Chongwenmennei");
			user.setStreetAddress2("Dongcheng District");
			user.setZipCode("100005");
			user.setCity("Beijing");
			user.setState("Beijing");
			user.setCountry("China");

			createUser(user);
			

			// presentation user
			user = new User();
			user.setFirstName("Xue Shan");
			user.setLastName("Tan");
			user.setProfilePicPath("thumbs/susantan.png");
			user.setGender("female");
			user.setEmail("xueshan.tan@croks.bodado.info");
			user.setUserName("xueshan.tan@croks.bodado.info");
			user.setPassword("xueshantan");
			user.setPhone("+1-412-234-2353");
			user.setJobTitle("Supplier");
			user.setCompany("Croks, Inc.");

			productIDs = productDAO
					.getProductIDByName("DX Uncrushable C100") + "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("EDT");
			user.setStartWorkTime("0900");
			user.setEndWorkTime("1800");
			user.setStreetAddress1("75 Chongwenmennei");
			user.setStreetAddress2("Dongcheng District");
			user.setZipCode("100005");
			user.setCity("Beijing");
			user.setState("Beijing");
			user.setCountry("China");

			createUser(user);

			// 1st dummy data
			user = new User();
			user.setFirstName("Eric");
			user.setLastName("Lin");
			user.setProfilePicPath("thumbs/adamhenry.png");
			user.setGender("male");
			user.setEmail("eric.lin@tenwest.bodado.info");
			user.setUserName("eric.lin@tenwest.bodado.info");
			user.setPassword("ericlin");
			user.setPhone("+1-412-234-2353");
			user.setJobTitle("Purchasing Director");
			user.setCompany("Ten West, Inc.");

			productIDs = productDAO.getProductIDByName("Annex Watchphone S200")
					+ ","
					+ productDAO.getProductIDByName("WiFi Detector Watch");
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("EDT");
			user.setStartWorkTime("0900");
			user.setEndWorkTime("1800");
			user.setStreetAddress1("5000 Forbes Avenue");
			user.setStreetAddress2(null);
			user.setZipCode("15213");
			user.setCity("Pittsburgh");
			user.setState("Pennsylvania");
			user.setCountry("United States of America");

			createUser(user);

			// 2nd dummy data
			user = new User();
			user.setFirstName("Jennifer");
			user.setLastName("Gates");
			user.setProfilePicPath("thumbs/jgates.png");
			user.setGender("female");
			user.setEmail("jennifer.gates@macrowat.bodado.info");
			user.setUserName("jennifer.gates@macrowat.bodado.info");
			user.setPassword("jennifergates");
			user.setPhone("+1-817-234-2322");
			user.setJobTitle("Purchasing Manager");
			user.setCompany("Watson, Inc.");

			productIDs = productDAO.getProductIDByName("Gibson Matrix") + "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("PDT");
			user.setStartWorkTime("1000");
			user.setEndWorkTime("2000");
			user.setStreetAddress1("500 Oracle Parkway");
			user.setStreetAddress2("Redwood Shores");
			user.setZipCode("94065");
			user.setCity("San Francisco");
			user.setState("California");
			user.setCountry("United States of America");

			createUser(user);

			// 3rd dummy data
			user = new User();
			user.setFirstName("Michelle");
			user.setLastName("Mary");
			user.setProfilePicPath("thumbs/michellemary.png");
			user.setGender("female");
			user.setEmail("michelle.mary@macrowat.bodado.info");
			user.setUserName("michelle.mary@macrowat.bodado.info");
			user.setPassword("michellemary");
			user.setPhone("+1-800-234-1452");
			user.setJobTitle("Director");
			user.setCompany("MacroWat, Inc.");

			productIDs = productDAO
					.getProductIDByName("Mr. Gadget 1GB USB Executive Watch")
					+ "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("EDT");
			user.setStartWorkTime("1000");
			user.setEndWorkTime("2000");
			user.setStreetAddress1("4200 Fifth Avenue");
			user.setStreetAddress2(null);
			user.setZipCode("15217");
			user.setCity("Los Angeles");
			user.setState("California");
			user.setCountry("United States of America");

			createUser(user);

			// 4th dummy data
			user = new User();
			user.setFirstName("Yong");
			user.setLastName("Kim");
			user.setProfilePicPath("thumbs/yongkim.png");
			user.setGender("male");
			user.setEmail("yong.kim@watson.bodado.info");
			user.setUserName("yong.kim@watson.bodado.info");
			user.setPassword("yongkim");
			user.setPhone("+82-31-3551133");
			user.setJobTitle("Purchasing Manager");
			user.setCompany("Watson, Inc.");

			productIDs = productDAO.getProductIDByName("Annex Watchphone S200")
					+ ","
					+ productDAO.getProductIDByName("WiFi Detector Watch");
			user.setProductIDs(productIDs);

			user.setPreferredLang("Korean");
			user.setTimeZone("KST");
			user.setStartWorkTime("0900");
			user.setEndWorkTime("1800");
			user.setStreetAddress1("673-7 Yangno-Ri");
			user.setStreetAddress2("Bibong-Myun ");
			user.setZipCode("142424");
			user.setCity("Seoul");
			user.setState("Gyeonggi-do");
			user.setCountry("Korea");

			createUser(user);

			// 5th dummy data
			user = new User();
			user.setFirstName("Hae");
			user.setLastName("Jeong");
			user.setProfilePicPath("thumbs/haejeong.png");
			user.setGender("female");
			user.setEmail("hae.jeong@watson.bodado.info");
			user.setUserName("hae.jeong@watson.bodado.info");
			user.setPassword("haejeong");
			user.setPhone("+82-31-479-3095");
			user.setJobTitle("Purchaser");
			user.setCompany("Watson, Inc.");

			productIDs = productDAO.getProductIDByName("Annex Watchphone S200")
					+ ","
					+ productDAO.getProductIDByName("DX Uncrushable C100");
			user.setProductIDs(productIDs);

			user.setPreferredLang("Korean");
			user.setTimeZone("KST");
			user.setStartWorkTime("0900");
			user.setEndWorkTime("1800");
			user.setStreetAddress1("Hogye Dong");
			user.setStreetAddress2(null);
			user.setZipCode("968574");
			user.setCity("Seoul");
			user.setState("Gyeonggi-do");
			user.setCountry("Korea");

			createUser(user);

			// 6th dummy data
			user = new User();
			user.setFirstName("Yun Woo");
			user.setLastName("Jin");
			user.setProfilePicPath("thumbs/yunwoo.png");
			user.setGender("male");
			user.setEmail("yunwoo.jin@innova.bodado.info");
			user.setUserName("yunwoo.jin@innova.bodado.info");
			user.setPassword("yunwoojin");
			user.setPhone("+86-20-82101009");
			user.setJobTitle("Purchasing Manager");
			user.setCompany("Innova, Inc.");

			productIDs = productDAO
					.getProductIDByName("Garmin Forerunner 405 Watch") + "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("Chinese");
			user.setTimeZone("CST");
			user.setStartWorkTime("0800");
			user.setEndWorkTime("2100");
			user.setStreetAddress1("Jianshe West Road");
			user.setStreetAddress2("Shengshi Dongfang Room 112");
			user.setZipCode("234242");
			user.setCity("Nanchang");
			user.setState("Jiangxi");
			user.setCountry("China");

			createUser(user);

			// 7th dummy data
			user = new User();
			user.setFirstName("Huang");
			user.setLastName("Li");
			user.setProfilePicPath("thumbs/huang.png");
			user.setGender("female");
			user.setEmail("li.huang@innova.bodado.info");
			user.setUserName("li.huang@innova.bodado.info");
			user.setPassword("lihuang");
			user.setPhone("+86-10-84725701");
			user.setJobTitle("Director");
			user.setCompany("Innova, Inc.");

			productIDs = productDAO.getProductIDByName("Binary Time Watch")
					+ "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("Chinese");
			user.setTimeZone("CST");
			user.setStartWorkTime("0800");
			user.setEndWorkTime("2100");
			user.setStreetAddress1("Junyue Square Quanceng");
			user.setStreetAddress2("No.50 Zhongshan");
			user.setZipCode("636323");
			user.setCity("Rushan");
			user.setState("Shandong");
			user.setCountry("China");

			createUser(user);

			// 8th dummy data
			user = new User();
			user.setFirstName("Li");
			user.setLastName("Du");
			user.setProfilePicPath("thumbs/aherchen.png");
			user.setGender("female");
			user.setEmail("li.du@tenwest.bodado.info");
			user.setUserName("li.du@tenwest.bodado.info");
			user.setPassword("lidu");
			user.setPhone("+86-21-33780685");
			user.setJobTitle("Purchasing manager");
			user.setCompany("Ten West, Inc.");

			productIDs = productDAO.getProductIDByName("Annex Watchphone S200")
					+ "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("Chinese");
			user.setTimeZone("CST");
			user.setStartWorkTime("0900");
			user.setEndWorkTime("1800");
			user.setStreetAddress1("Fuluhe Town");
			user.setStreetAddress2(null);
			user.setZipCode("356424");
			user.setCity("Taicang");
			user.setState("Jiangshu");
			user.setCountry("China");

			createUser(user);

			// 9th dummy data
			user = new User();
			user.setFirstName("Rui");
			user.setLastName("Lee");
			user.setProfilePicPath("thumbs/ruilee.png");
			user.setGender("male");
			user.setEmail("rui.lee@innova.bodado.info");
			user.setUserName("rui.lee@innova.bodado.info");
			user.setPassword("ruilee");
			user.setPhone("+86-22-26373420");
			user.setJobTitle("Purchaser");
			user.setCompany("Innova, Inc.");

			productIDs = productDAO
					.getProductIDByName("W100 Mobile Phone Wrist Watch")
					+ ","
					+ productDAO.getProductIDByName("WizMatch S100");
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("CST");
			user.setStartWorkTime("0800");
			user.setEndWorkTime("2100");
			user.setStreetAddress1("Yi Canonical Shiwu Lou 5032");
			user.setStreetAddress2(null);
			user.setZipCode("253532");
			user.setCity("Hangzhou");
			user.setState("Zhejiang");
			user.setCountry("China");

			createUser(user);
			
			//10 dummy data - Malika Gopal
			user = new User();
			user.setFirstName("Malika");
			user.setLastName("Gopal");
			user.setProfilePicPath("thumbs/malikagopal.png");
			user.setGender("female");
			user.setEmail("malika.gopal@ambersonwatchtech.bodado.info");
			user.setUserName("malika.gopal@ambersonwatchtech.bodado.info");
			user.setPassword("malikagopal");
			user.setPhone("+86-22-26373420");
			user.setJobTitle("Purchaser");
			user.setCompany("Amberson WatchTec");

			productIDs = productDAO.getProductIDByName("DX Uncrushable C100")+ "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("WIB");
			user.setStartWorkTime("0800");
			user.setEndWorkTime("2100");
			user.setStreetAddress1("Salayang 5032");
			user.setStreetAddress2(null);
			user.setZipCode("253532");
			user.setCity("Batu");
			user.setState("Java");
			user.setCountry("Indonesia");

			createUser(user);
			
			//11 dummy data - Alice Braga
			user = new User();
			user.setFirstName("Alice");
			user.setLastName("Braga");
			user.setProfilePicPath("thumbs/alicebraga.png");
			user.setGender("female");
			user.setEmail("alice.braga@hutchinsonnova.bodado.info");
			user.setUserName("alice.braga@hutchinsonnova.bodado.info");
			user.setPassword("alicebraga");
			user.setPhone("+86-22-26373420");
			user.setJobTitle("Purchaser");
			user.setCompany("Hutchinson Nova");

			productIDs = productDAO.getProductIDByName("DX Uncrushable C100")+ "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("WIB");
			user.setStartWorkTime("0800");
			user.setEndWorkTime("2100");
			user.setStreetAddress1("Salayang 5032");
			user.setStreetAddress2(null);
			user.setZipCode("253532");
			user.setCity("Batu");
			user.setState("Java");
			user.setCountry("Indonesia");

			createUser(user);
			
			//12th dummy data - John Kani
			user = new User();
			user.setFirstName("John");
			user.setLastName("Kani");
			user.setProfilePicPath("thumbs/johnkani.png");
			user.setGender("male");
			user.setEmail("john.kani@pcnwatchmax.bodado.info");
			user.setUserName("john.kani@pcnwatchmax.bodado.info");
			user.setPassword("johnkani");
			user.setPhone("+86-22-26373420");
			user.setJobTitle("Purchaser");
			user.setCompany("PCN WatchMax");

			productIDs = productDAO.getProductIDByName("DX Uncrushable C100")+ "";
			user.setProductIDs(productIDs);

			user.setPreferredLang("English");
			user.setTimeZone("WIB");
			user.setStartWorkTime("0800");
			user.setEndWorkTime("2100");
			user.setStreetAddress1("Salayang 5032");
			user.setStreetAddress2(null);
			user.setZipCode("253532");
			user.setCity("Batu");
			user.setState("Java");
			user.setCountry("Indonesia");

			createUser(user);

		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

}